library Wave13e initializer init requires LegacySystem

	globals
		private integer MinosAlive = 0
	endglobals
	
    private function MinosKills takes nothing returns nothing
        local integer i=1
        set MinosAlive=MinosAlive-1
        if udg_Mode==1 then
            call ALICE2Text(10.0, "Minos neutralized. |cff1e90ff20 XP|r awarded to all Marines." )
            loop
                exitwhen i>udg_InitialPlayers
                if GetPlayerSlotState(ConvertedPlayer(udg_Sorted[i]))!=PLAYER_SLOT_STATE_LEFT then
                    set udg_Experience[udg_Sorted[i]] = udg_Experience[udg_Sorted[i]] + 20
                endif
                set i=i+1
            endloop
        endif
        if MinosAlive<=0 then
            call DisableTrigger(GetTriggeringTrigger())
        endif
    endfunction

    private function Wave13e takes nothing returns nothing
        local integer i=1
        local trigger t=CreateTrigger()
		set udg_soundpath = "war3mapImported\\StarcraftZerg3compressed.mp3"
        call PlaySoundPath.execute()
        set udg_CurrentWave = 13
        call TriggerAddAction(t, function MinosKills)
        call SetProximitySpawnEnabled(true)
        call GenericActions.execute()
        call RandomSpawn('z00C',2,GetRandomInt(0,1)) //Assasin
        call GeneralText(3.0, "|cffcd950cMarine|r : I'm tracking at least half a dozen Class As. We don't have the firepower to take them all out." )
        set MinosAlive=8 //Tracks Minos' Alive
        loop
            exitwhen i>8
            set udg_myloc = GetRandomLocInRect(udg_PlayerSpawnBoundary)
            set udg_Boss2[i]=CreateUnitAtLoc(Player(13),'U00K',udg_myloc,0) //Minos
            call TriggerRegisterUnitEvent(t,udg_Boss2[i],EVENT_UNIT_DEATH)
            call SuspendHeroXP(udg_Boss2[i],true)
            call RemoveLocation(udg_myloc)
            call TriggerSleepAction(0.)
            set i=i+1
        endloop
        call GeneralText(3.0, "|cffcd950cMarine #2|r : Keep on your feet, we're going to have to evade them." )
        call PolledWait(10.)
        call GeneralText(3.0, "|cffcd950cMarine|r : Maybe we can round them up and take a large chunk of them out with explosives." )
        set t = null
        call PolledWait(140.*udg_Pace)
        call ExecuteRegisteredFunction("Wave14e")
        //call Wave14e.execute()
    endfunction

    private function init takes nothing returns nothing
        call RegisterFunction("Wave13e", function Wave13e)
        // call ExecuteRegisteredFunction("Wave13e")
    endfunction

endlibrary

